package modelLayer;
import java.util.ArrayList;

public class TeachingBlockCon {
	private static TeachingBlockCon instance;
	private ArrayList<TeachingBlock> tbList;
	
	private TeachingBlockCon(){
		tbList = new ArrayList<>();
	}
	
	public static TeachingBlockCon getInstance(){
		if (instance == null){
			instance = new TeachingBlockCon();
		}
		return instance;
	}
	
	public void addTeachingBlock(TeachingBlock tb){
		tbList.add(tb);
	}
	
	public void removeTeachingBlock(TeachingBlock tb){
		boolean temp = false;
		for (int i = 0; i < tbList.size() && temp == false; i++){
			if (tbList.get(i).equals(tb)){
				temp = tbList.remove(tbList.get(i));
			}
		}
	}
	
	public TeachingBlock findTeachingBlock(TeachingBlock tb){
		boolean temp = false;
		TeachingBlock tbTemp = null;
		for (int i = 0; i < tbList.size() && temp == false; i++){
			if (tbList.get(i).equals(tb)){
				tbTemp = tbList.get(i);
				temp = true;
			}
		}
		return tbTemp;
	}
	
}
